<template>
  <div style="margin-top: 1.5%">
    <div class="sidebar">
      <!-- 跳转到指定模块 -->
      <el-card class="btn-box">
        <el-button
          style="margin-left: 10px"
          @click="ding"
        >费用相关事件
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 1,20)"
        >事件情况描述
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 2,20)"
        >患者资料
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 3,20)"
        >事件基本信息
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 4,20)"
        >当事人资料
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 5,20)"
        >事件结果
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 6,20)"
        >报告者信息
        </el-button>
      </el-card>
    </div>

    <div class="content">
      <el-collapse v-model="activeNames" >
        <!--        <el-collapse-item  name="1" >-->
        <!--        <el-collapse-item title="费用相关事件" name="1" class="bname" ref="block0">-->
        <!--        <el-collapse-item title="费用相关事件" name="1" class="bname" ref="block0">-->
        <!--          </el-collapse-item>-->
        <!--          </el-collapse-item>-->
        <!--          </el-collapse-item>-->
        <!--费用相关事件-->
        <div class="bname" ref="block0"></div>
        <div style="width: 100%; margin-left: 8%">

          <el-collapse-item name="1">
            <template slot="title">
              <span style="font-weight: bold;font-size: 20px">费用相关事件</span>
            </template>
            <div class="block" style="margin-top: 0.5%;">
              <el-form ref="form" :model="basicForm" label-width="140px"   :rules="rules9">
                <el-form-item label="费用相关事件" prop="costRelatedEvent" >
                  <el-radio-group v-model=" basicForm.costRelatedEvent"  >
                    <el-radio label="01" style="margin-top: 10px; margin-bottom: 10px">错收费</el-radio>
                    <br>
                    <el-radio label="02" style="margin-bottom: 10px">漏收费</el-radio>
                    <br>
                    <el-radio label="03" style="margin-bottom: 10px">收费异议</el-radio>
                    <br>
                    <el-radio label="04" style="margin-bottom: 10px">欠费</el-radio>
                    <br>
                    <el-radio label="05" style="margin-bottom: 10px">逃费</el-radio>
                    <br>
                    <el-radio label="06" style="margin-bottom: 10px">涉嫌保险欺诈</el-radio>
                    <br>
                    <el-radio label="07" style="margin-bottom: 10px">医保报销管理相关</el-radio>
                    <br>
                    <el-radio label="08" style="margin-bottom: 10px">其他</el-radio>
                  </el-radio-group>
<!--                  <el-form-item v-if="basicForm.costRelatedEvent==='08'">-->
<!--                    <el-form-item type="textarea" label="其他" style="margin-left: -20% ;label-width:130px;width: 600px">-->
<!--                      <el-input-->

<!--                        v-model="basicForm.undesc"-->
<!--                        maxlength="50"-->
<!--                        placeholder=""-->
<!--                        resize="none">-->
<!--                      </el-input>-->
<!--                    </el-form-item>-->
<!--                  </el-form-item>-->

                </el-form-item>
              </el-form>
            </div>
          </el-collapse-item>
        </div>


        <!--事件情况描-->
        <div class="bname" ref="block1"></div>
        <div style="width: 100%; margin-top:1%; margin-left: 8%">

          <el-collapse-item name="2">
            <template slot="title">
              <span style="font-weight: bold;font-size: 20px">事件情况描述</span>
            </template>
            <div class="block" style="margin-top: 0.5%;">
              <el-form ref="form1" :model="reportForm" label-width="140px" :rules="miaoshurule">
                <el-form-item label="事件描述或事件经过"
                              style="width: 600px; margin-top: 15px " prop="situationEdescriptionProcess">
                  <el-input type="textarea" v-model="reportForm.situationEdescriptionProcess" :rows="5" maxlength="1000"
                            resize="none" ></el-input>
                  <!--                        <el-input v-model="form.badname" placeholder="如:头晕(一般);呕吐(严重)"></el-input>-->
                </el-form-item>
                <el-form-item v-model="reportForm.situationMeasuresEvent" label="事件发生时是否采取处理措施"
                           prop="situationMeasuresEvent"  >
                  <el-radio-group v-model="reportForm.situationMeasuresEvent">
                    <el-radio label="01" v-model="reportForm.situationMeasuresEvent">是</el-radio>
                    <el-radio label="02" v-model="reportForm.situationMeasuresEvent">否</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="采取的处理措施"
                              style="width: 600px;margin-top: 15px" prop="situationTakenMeasures">
                  <el-input type="textarea" v-model="reportForm.situationTakenMeasures" :rows="5"
                            resize="none"   maxlength="1000"
                            ></el-input>
                </el-form-item>

              </el-form>
            </div>
          </el-collapse-item>
        </div>

        <!--患者资料-->
        <div class="bname" ref="block2"></div>
        <div style="width: 100%; margin-left: 8%; margin-top:1%">

          <el-collapse-item name="3">
            <template slot="title">
              <span style="font-weight: bold;font-size: 20px">患者资料</span>
            </template>
            <div class="block" style="margin-top: 0.5%;">
              <el-form ref="reportform1" :model="reportForm" :rules="huanzherules" label-width="140px">
                <el-form-item label="是否涉及患者" prop="patientInvolved">
                  <el-radio-group v-model="reportForm.patientInvolved">
                    <el-radio label="01">是</el-radio>
                    <el-radio label="02">否</el-radio>
                  </el-radio-group>
                </el-form-item>
                <div >
                  <el-form-item label="诊断类别" prop="patientDiagnosisCategory"  :rules="[{required: true, message: '诊断类别未选择'}]">
                    <el-radio-group v-model="reportForm.patientDiagnosisCategory">
                      <el-radio label="01">急诊</el-radio>
                      <el-radio label="02">门诊</el-radio>
                      <el-radio label="03">住院</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="病历号/门诊号" style="width: 600px; margin-top: 15px" prop="patientRecordOutpatient">
                    <el-input v-model="reportForm.patientRecordOutpatient" maxlength="50" ></el-input>
                  </el-form-item>
                  <el-form-item label="姓名" style="width: 600px; margin-top: 15px" prop="patientName">
                    <el-input v-model="reportForm.patientName"  maxlength="30"  ></el-input>
                  </el-form-item>
                  <el-form-item label="性别" prop="patientGender" style="width: 600px;margin-top: 15px">
                    <el-radio-group v-model="reportForm.patientGender" >
                      <el-radio label="01">男</el-radio>
                      <el-radio label="02">女</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="出生日期" prop="patientDateOfBirth" style=" margin-top: 15px">
                    <el-date-picker
                      v-model="reportForm.patientDateOfBirth"
                      type="date"
                      placeholder="选择日期">
                    </el-date-picker>
                  </el-form-item>
                  <el-form-item label="年龄" style="width: 600px;margin-top: 15px" prop="patientAge" :rules="[{pattern:/^-?[1-9]\d{0,2}$/, message: '请填写数字'}]">
                    <el-input v-model="reportForm.patientAge" maxlength="3" ></el-input>
                  </el-form-item>
                  <el-form-item label="年龄阶段" prop="patientAgeStage" style="margin-top: 15px">
                    <el-select v-model="reportForm.patientAgeStage" placeholder="请选择" filterable>
                      <el-option
                        v-for="item in ageStageOption"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="家属联系电话" style="width: 600px" prop="patientFamilyNumber">
                    <el-input v-model="reportForm.patientFamilyNumber" maxlength="12" ></el-input>
                  </el-form-item>
                  <el-form-item label="入院就诊时间" prop="patientAdmissionTime" style="width: 600px;margin-top: 15px">
                    <el-date-picker
                      v-model="reportForm.patientAdmissionTime"
                      type="datetime"
                      placeholder="选择日期时间">
                    </el-date-picker>
                  </el-form-item>
<!--                  <el-form-item label="科室">-->
<!--                    <el-select v-model="reportForm.patientDepartment" filterable>-->
<!--                      <el-option-->
<!--                        v-for="item in keshiFormOption"-->
<!--                        :key="item.value"-->
<!--                        :label="item.value"-->
<!--                        :value="item.value">-->
<!--                      </el-option>-->
<!--                    </el-select>-->
<!--                  </el-form-item>-->
                  <el-form-item label="床号" style="width: 600px;margin-top: 15px" prop="patientBedNumber">
                    <el-input v-model="reportForm.patientBedNumber" maxlength="50" ></el-input>
                  </el-form-item>
                  <el-form-item label="护理级别" prop="patientNursingLevel">
                    <el-radio-group v-model="reportForm.patientNursingLevel">
                      <el-radio label="01">特级护理</el-radio>
                      <el-radio label="02">Ⅰ级护理</el-radio>
                      <el-radio label="03">Ⅱ级护理</el-radio>
                      <el-radio label="04">Ⅲ级护理</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="文化程度" prop="patientEducationLevel">
                    <el-radio-group v-model="reportForm.patientEducationLevel">
                      <el-radio label="01">研究生</el-radio>
                      <el-radio label="02">大学本科</el-radio>
                      <el-radio label="03">大学专科</el-radio>
                      <el-radio label="04">中专（中技）</el-radio>
                      <el-radio label="05">高中</el-radio>
                      <el-radio label="06">初中</el-radio>
                      <el-radio label="07">小学</el-radio>
                      <el-radio label="08">文盲</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="诊断(多个诊断之间用逗号隔开)" style="width: 600px" prop="patientDiagnosis">
                    <el-input type="textarea" :rows="5" v-model="reportForm.patientDiagnosis"
                              placeholder="请输入内容" maxlength="200" resize="none"></el-input>
                  </el-form-item>
                </div>
              </el-form>
            </div>
          </el-collapse-item>
        </div>

        <!--事件基本信息-->
        <div class="bname" ref="block3"></div>
        <div style="width: 100%; margin-left: 8%; margin-top:1%">

          <el-collapse-item name="4">
            <template slot="title">
              <span style="font-weight: bold;font-size: 20px">事件基本信息</span>
            </template>
            <!--        <div style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">事件基本信息</div>-->
            <div class="block" style="margin-top: 0.5%;">
              <el-form ref="reportForm8" :model="reportForm" label-width="140px" :rules="jibenrules">
                <el-form-item label="发生时间" prop="occurrenceTime">
                  <el-date-picker
                    v-model="reportForm.occurrenceTime"
                    type="datetime"
                    placeholder="选择日期时间">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="发生日期" style=" margin-top: 15px" prop="occurrenceDate">
                  <el-date-picker
                    v-model="reportForm.occurrenceDate"
                    type="date"
                    placeholder="选择日期时间">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="日期类型" style=" margin-top: 15px">
                  <el-radio-group v-model="reportForm.occurrenceDateType">
                    <el-radio label="工作日"></el-radio>
                    <el-radio label="周末"></el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="发生时段">
                  <el-radio-group v-model="reportForm.occurrenceTimePeriod">
                    <el-radio label="01">上午(08：00-12：00)</el-radio>
                    <el-radio label="02">中午(12：00-14：00)</el-radio>
                    <el-radio label="03">下午(14：00-18：00)</el-radio>
                    <el-radio label="04">上夜(18：00-00：00)</el-radio>
                    <el-radio label="05">下夜(00：00-08：00)</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="发生地点" style="width: 600px" prop="occurrenceLocation">
                  <el-input v-model="reportForm.occurrenceLocation" maxlength="40"></el-input>
                </el-form-item>
                <!--上传图片-->
                <el-form-item label="现场照片" prop="images">
                  <image-upload :limit="1" v-model="reportForm.occurrenceScenePhotos"/>
                </el-form-item>
                <!--          <el-form-item label="事件发生时是否采取处理措施" :rules="[{required: true, message: '事件发生时是否采取处理措施未选择'}]">-->
                <!--            <el-radio-group v-model="form.medicineType">-->
                <!--              <el-radio label="是"></el-radio>-->
                <!--              <el-radio label="否"></el-radio>-->
                <!--            </el-radio-group>-->
                <!--          </el-form-item>-->
                <!--          <el-form-item label="采取的处理措施" >-->
                <!--            <el-input type="textarea" :rows="5" v-model="form.approvalNum" resize="none" placeholder="请输入内容"></el-input>-->
                <!--          </el-form-item>-->
              </el-form>
            </div>
          </el-collapse-item>
        </div>

        <!--当事人资料-->
        <div class="bname" ref="block4"></div>
        <div style="width: 100%; margin-left: 8%; margin-top:1%">
          <el-collapse-item name="5">

            <template slot="title">
              <span style="font-weight: bold;font-size: 20px">当事人资料</span>
            </template>
            <!--        <div style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">当事人资料</div>-->
            <!--        <div style="color:blue;margin-top: 1%;font-size: 14px">怀疑药品</div>-->
            <div class="block" style="margin-top: 0.5%;">
              <el-form ref="reportForm7" :model="reportForm" label-width="140px" :rules="dangshirenrules">
                <el-form-item label="姓名" style="width: 600px" prop="partyName">
                  <el-input v-model="reportForm.partyName" maxlength="20"></el-input>
                </el-form-item>
                <el-form-item label="年龄" style="width: 600px; margin-top: 15px" prop="partyAge"    >
                  <el-input v-model="reportForm.partyAge" maxlength="4" style=" "></el-input>
                </el-form-item>
                <el-form-item label="工作年限">
                  <el-radio-group v-model="reportForm.partyYearsOfExperience">
                    <el-radio label="01"><1年</el-radio>
                    <el-radio label="02">1≤y≤2</el-radio>
                    <el-radio label="03">2≤y≤5</el-radio>
                    <el-radio label="04">5≤y≤10</el-radio>
                    <el-radio label="05">10≤y≤20</el-radio>
                    <el-radio label="06">≥20年</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="类别">
                  <el-radio-group v-model="reportForm.partyCategory">
                    <el-radio label="01">在编</el-radio>
                    <el-radio label="02">聘用</el-radio>
                    <el-radio label="03">进修</el-radio>
                    <el-radio label="04">实习</el-radio>
                    <el-radio label="05">轮转</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="学历">
                  <el-radio-group v-model="reportForm.partyEducation">
                    <el-radio label="01">中专</el-radio>
                    <el-radio label="02">大专</el-radio>
                    <el-radio label="03">本科</el-radio>
                    <el-radio label="04">硕士</el-radio>
                    <el-radio label="05">其他</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="职务">
                  <el-radio-group v-model="reportForm.partyPosition">
                    <el-radio label="01">医疗</el-radio>
                    <el-radio label="02">药剂</el-radio>
                    <el-radio label="03">护理</el-radio>
                    <el-radio label="04">医技</el-radio>
                    <el-radio label="05">检验</el-radio>
                    <el-radio label="06">工程技术</el-radio>
                    <el-radio label="07">行政管理</el-radio>
                    <el-radio label="08">后勤保障</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-form>
            </div>
          </el-collapse-item>
        </div>

        <!--事件结果-->
        <div class="bname" ref="block5"></div>
        <div style="width: 100%; margin-left: 8%; margin-top:1%">
          <el-collapse-item name="6">

            <template slot="title">
              <span style="font-weight: bold;font-size: 20px">事件结果</span>
            </template>
            <!--        <div class="bname" ref="block5" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">事件结果</div>-->
            <div class="block" style="margin-top: 0.5%;">
              <el-form ref="reportform" :model="reportForm" :rules="jieguorules" label-width="140px">
                <el-form-item label="纠纷或纠纷隐患可能性" prop="resultsPossibilityDispute">
                  <el-radio-group v-model="reportForm.resultsPossibilityDispute" >
                    <el-radio label="01">确定有</el-radio>
                    <el-radio label="02">可能有</el-radio>
                    <el-radio label="03">无</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="事件严重程度" prop="resultsEventSeverity"  style="margin-top: 15px;">
                  <el-select v-model="reportForm.resultsEventSeverity" placeholder="请选择" filterable>
                    <el-option
                      v-for="item in thingSeriousOption"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="事件分级" style="width: 600px" prop="resultsEventClassification">
                  <el-radio-group v-model="reportForm.resultsEventClassification">
                    <el-radio label="01" style="margin-top: 10px; margin-bottom: 10px">Ⅰ级事件: 发生错误，造成患者死亡 (包括损害程度I级)
                    </el-radio>
                    <el-radio label="02" style="margin-bottom: 10px">Ⅱ级事件: 发生错误，且造成患者伤害 (包括损害程度E、F、G、H级)</el-radio>
                    <el-radio label="03" style="margin-bottom: 10px">Ⅲ级事件: 发生错误，但未造成患者伤害 (包括损害程度B、C、D级)</el-radio>
                    <el-radio label="04">Ⅳ级事件: 错误未发生 (错误隐患)(包括损害程度A级)</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="伤害严重度" prop="resultsSeverityInjury">
                  <el-radio-group v-model="reportForm.resultsSeverityInjury">
                    <el-radio label="01">死亡</el-radio>
                    <el-radio label="02">极度严重</el-radio>
                    <el-radio label="03">重度</el-radio>
                    <el-radio label="04">中度</el-radio>
                    <el-radio label="05">轻度</el-radio>
                    <el-radio label="06">未造成伤害</el-radio>
                    <el-radio label="07">无伤害</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-form>
            </div>
          </el-collapse-item>
        </div>

        <!--  报告者信息-->
        <div class="bname" ref="block6"></div>
        <div style="width: 100%; margin-left: 8%; margin-top:1%">
          <el-collapse-item name="7">

            <template slot="title">
              <span style="font-weight: bold;font-size: 20px">报告者信息</span>
            </template>
            <!--        <div class="bname" ref="block6" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">报告者信息</div>-->
            <div class="block" style="margin-top: 0.5%;">
              <el-form ref="form2" :model="reportForm" label-width="140px" :rules="baogaorules">
                <el-form-item label="事件呈报方式" prop="reportMethod">
                  <el-radio-group v-model="reportForm.reportMethod" >
                    <el-radio label="01">主动呈报</el-radio>
                    <el-radio label="02">投诉</el-radio>
                    <el-radio label="03">他人报告</el-radio>
                    <el-radio label="04">质量检查发现</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="其他信息备注" style="width: 600px;margin-top: 20px">
                  <el-input type="textarea" :rows="5" v-model="reportForm.reportOtherRemarks" resize="none"
                            placeholder="请输入内容" maxlength="200"></el-input>
                </el-form-item>
                <!--上传图片-->
                <el-form-item label="附件图片" prop="images">
                  <image-upload :limit="1" v-model="reportForm.reportAttachedImages"/>
                </el-form-item>
              </el-form>
            </div>
          </el-collapse-item>
        </div>

      </el-collapse>
    </div>

    <!--保存按钮-->
    <div style="position: fixed; margin-top: -0.5%; right: 3%; width: 300px">
      <el-button
        type="primary"
        style="margin-left: 15px"
        @click="baocun"
      >保存
      </el-button>
      <el-button
        type="info" plain
        style="margin-left: 15px"
        @click="fanhui"
      >返回
      </el-button>
    </div>

  </div>

</template>

<script>
import ScrollPane from "@/layout/components/TagsView/ScrollPane";
import {addBasic} from "@/api/module/ljt/basic";
import {getBasic, updateBasic} from "@/api/module/shao/shijian/basic";

export default {
  components: {ScrollPane},
  data() {
    return {
      activeNames: ['1','2','3','4','5','6','7','8'],
      checkList: [],
      dimian: [],
      yuanyin: [],
      chuli: [],
      formEvent: {
        //代表是事件基本信息表
        heEventBasic: {},
        //代表事件上传信息表
        heEventReport: {},
        //代表事件流程表
        heEventFlow: {},
      },
      //代表事件基本信息表
      basicForm: {
        //这个就是新增到事件基本信息表的跌倒事件




        costRelatedEvent: null,
        undesc: null


      },
      // 表单校验
      rules: {
        // bedTemperature:[{
        //   required:true,message:"上报不能为空",trigger:"blur"
        // }],
        // resultsEventClassification:[{
        //   required:true,message:"上报不能为空",trigger:"blur"
        // }],
        // resultsEventSeverity:[{
        //   required:true,message:"上报不能为空",trigger:"blur"
        // }],
        // patientName:[{
        //   required:true,message:"姓名不能为空",trigger:"blur"
        // }],
      },
      rules9: {

        costRelatedEvent: [{
          required: true, message: "相关事件未选择"
        }],

      },

      miaoshurule: {
        situationEdescriptionProcess: [{
          required: true, message: "事件描述或事件经过不能为空"
        }],
        situationMeasuresEvent: [{
          required: true, message: "事件发生时是否采取处理措施不能为空"
        }],

      },
      huanzherules: {
        //限制姓名

        patientInvolved: [{
          required: true, message: "是否涉及患者未选择"
        }
        ],
        patientDiagnosis: [{
          required: true, message: "诊断未填写"
        }
        ],
        patientName: [{
          required: true, message: "姓名不能为空"
        },{pattern:/^[\u4e00-\u9fa5a-zA-Z]+$/, message: '姓名格式不正确'}
        ],
        patientGender: [{
          required: true, message: "性别未选择"
        }
        ],
        //限制床号
        patientBedNumber: [{
          required: true, message: "床号不能为空"
        }, {pattern:/^[0-9]+$/, message: '请填写数字',trigger: "blur"},
          {min: 1, max: 50, message: '长度在 1-50 个字符'}
        ],
        //限制门诊号
        patientRecordOutpatient: [{
          required: true, message: "门诊号不能为空"
        }, {pattern:/^[0-9]+$/, message: '请填写数字',trigger: "blur"},
          {min: 1, max: 50, message: '长度在 1-50 个字符'}
        ],
        patientAge: [{min: 1, max: 50, message: '长度在 1-50 个字符'}
        ],
        patientFamilyNumber: [{
          required: true, message: "家属联系电话不能为空"
        }, {pattern:/^[0-9]+$/, message: '请填写数字',trigger: "blur"},{min: 1, max: 50, message: '长度在 1-50 个字符'}
        ],
      },
      jibenrules: {

        occurrenceTime: [
          { required: true, message: '发生时间不能为空'}
        ],
        occurrenceDate: [
          {required: true,  message: '发生日期不能为空'}
        ],

      },
      dangshirenrules: {
        partyName: [{
          required: true, message: "当事人资料姓名不能为空"
        },,{pattern:/^[\u4e00-\u9fa5a-zA-Z]+$/, message: '姓名格式不正确'},
          {
            min: 1, max: 50, message: '长度在 1-50 个字符'}
        ],
        partyAge: [{
          required: true, message: "当事人年龄不能为空"
        }, {pattern:/^[0-9]+$/, message: '请填写数字',trigger: "blur"},
          {
            min: 1, max: 50, message: '长度在 1-50 个字符'}
        ],
      },
      jieguorules: {
        //限制事件分级resultsPossibilityDispute
        resultsPossibilityDispute: [{
          required: true, message: "纠纷或纠纷隐患可能性未选择"
        }],
        resultsEventClassification: [{
          required: true, message: "事件分级不能为空"
        }],
        //限制事件严重程度
        resultsEventSeverity: [{
          required: true, message: "事件严重程度不能为空"
        }],
        //限制伤害严重度
        resultsSeverityInjury: [{
          required: true, message: "伤害严重度不能为空"
        }],
      },
      baogaorules: {
        reportMethod: [{
          required: true, message: "事件呈报方式不能为空"
        }],
      },
      form: {

        other: '',
        details: '',
        treatmentMeasure: '',
        treatmentMeasures: '',
        results: '',
        differentiate: '是',

        badno: '',

        processDepartment: '',
        recordNumber: '',
        diagnosis: '',
        occurrenceTime: '',
        occurrenceDate: '',
        dateType: '',
        occurrencePeriod: '',
        place: '',

        age: '',
        workingSeniority: '',
        type: '',
        education: '',
        qita: '',
        dutie: '',
        title: '',

        eventContracting: '',
        otheRemarks: '',
        danwei: '',
        sheji: '',
        name: '',
        admissionTime: '',
        reportcategory: '',
        reporttype: '',
        badname:'',
        enhappentime: '',
        enfindtime: '',
        undesc: '',
        diagcategory: '',
        patientname: '',
        patientgender: '',
        familyContact: '',
        birdate: '',
        patientage: '',
        agestage: '',
        ethnicGroup: '',
        weightKg: '',
        telephNum: '',
        preDisease: '',
        medcliNum: '',
        drugReaction: '',
        familReaction: '',
        reinimf: [],
        otherInform: '',
        allergyInstru: '',
        bymedicineType: '',
        byapprovalNum: '',
        byproductName: '',
        bycurrentName: '',
        bydosageform: '',
        bymanuFacturer: '',
        bymanuNum: '',
        bydosage: '',
        byunti: '',
        untiDay: '',
        cGiveyao: '',
        giveWay: '',
        medstaTime: '',
        medstopTime: '',
        medUsereason: '',
        medicineType: '',
        approvalNum: '',
        productName: '',
        currentName: '',
        dosageform: '',
        manuFacturer: '',
        manuNum: '',
        dosage: '',
        unti: '',
        byuntiDay: '',
        bycGiveyao: '',
        bygiveWay: '',
        bymedstaTime: '',
        bymedstopTime: '',
        bymedUsereason: '',
        badJieguo: '',
        ynReduce: '',
        againInfact: '',
        yuanYing: '',
        bgPeoplepjia: '',
        firqianName: '',
        bgpeopleNum: '',
        bgPeoplejob: '',
        bgPlacepjia: '',
        secqianName: '',
        workName: '',
        lianxiRen: '',
        dianhuaNum: '',
        bgBei: '',
        jiuImpossible: '',
        thingFenji: '',
        hurtDu: '',
        thingSerious: '',

      },
      //代表事件上报信息表
      reportForm: {
        reportEventType: '36',
        reviewEventType: '01',
        //以下都是新增到事件上传信息表的字段
        //事件情况描述
        situationEdescriptionProcess: '',
        situationMeasuresEvent: '',
        situationTakenMeasures: '',
        situationCausesconsequences: '',
        //患者资料
        patientInvolved: '',
        patientDiagnosisCategory: '',
        patientRecordOutpatient: '',
        patientName: '',
        patientGender: '',
        patientDateOfBirth: '',
        patientAge: '',
        patientAgeStage: '',
        patientEthnicGroup: '',
        patientWeight: '',
        patientPreDisease: '',
        patientContact: '',
        patientFamilyNumber: '',
        patientAdmissionTime: '',
        patientDepartment: '',
        patientBedNumber: '',
        patientNursingLevel: '',
        patientEducationLevel: '',
        patientDiagnosis: '',
        //其他情况暂时没有字段以后加这里先写死
        //事件基本信息
        occurrenceTime: '',
        occurrenceDate: '',
        occurrenceDateType: '',
        occurrenceTimePeriod: '',
        occurrenceLocation: '',
        occurrenceScenePhotos: '',
        //当事人资料
        partyName: '',
        partyAge: '',
        partyYearsOfExperience: '',
        partyCategory: '',
        partyEducation: '',
        partyPosition: '',
        partyPost: '',
        //事件结果
        resultsPossibilityDispute: '',
        resultsEventSeverity: '',
        resultsEventClassification: '',
        resultsSeverityInjury: '',
        //报告者信息(上报信息)
        reportMethod: '',
        reportAttachedImages: '',
        reportOtherRemarks: '',
        note1: '',
      },
      //代表事件流程表
      flowForm: {},
      keshiFormOption: [
        {
          value: '护理科',
        },  {
          value: '呼吸科',
        }, {
          value: '信息科',
        }, {
          value: '脑科',
        }, {
          value: '放射科',
        }, {
          value: '神经科',
        }, {
          value: '皮肤科',
        },{
          value: '急诊科',
        }, {
          value: '儿科',
        }, {
          value: '中医科',
        }
      ],
      ageStageOption: [
        {
          value: '01',
          label: '新生儿'
        }, {
          value: '02',
          label: '1-6月'
        }, {
          value: '03',
          label: '7-12月'
        }, {
          value: '04',
          label: '1-6岁'
        }, {
          value: '05',
          label: '7-12岁'
        }, {
          value: '06',
          label: '13-18岁'
        }, {
          value: '07',
          label: '19-64岁'
        }, {
          value: '08',
          label: '65岁以上'
        }, {
          value: '09',
          label: '其他'
        },
      ],
      ageStageOption1: [ //科室
        {
          value: '护理科',
        },  {
          value: '呼吸科',
        }, {
          value: '信息科',
        }, {
          value: '脑科',
        }, {
          value: '放射科',
        }, {
          value: '神经科',
        }, {
          value: '皮肤科',
        },{
          value: '急诊科',
        }, {
          value: '儿科',
        }, {
          value: '中医科',
        }
      ],
      ethnicGroupOption: [],
      dosageFormOption1: [
        {
          value: '01',
          label: '失明',
        }, {
          value: '02',
          label: '视力减退',
        }, {
          value: '03',
          label: '眩晕',
        }, {
          value: '04',
          label: '耳聋',
        }, {
          value: '05',
          label: '脑血管病',
        }, {
          value: '06',
          label: '帕金森氏病',
        }, {
          value: '07',
          label: '癫痫',
        }, {
          value: '08',
          label: '精神病',
        }, {
          value: '09',
          label: '酗酒',
        }, {
          value: '10',
          label: '老年痴呆',
        }, {
          value: '11',
          label: '其他',
        },
      ],
      dosageFormOption2: [
        {
          value: '01',
          label: '镇静剂'
        }, {
          value: '02',
          label: '降压药'
        }, {
          value: '03',
          label: '降糖药'
        }, {
          value: '04',
          label: '散剂'
        }, {
          value: '05',
          label: '抗癫痫药'
        }, {
          value: '06',
          label: '利尿剂'
        }, {
          value: '07',
          label: '抗心律失常药'
        }, {
          value: '08',
          label: '止痛药'
        }, {
          value: '09',
          label: '抗精神药'
        }, {
          value: '10',
          label: '其他'
        },
      ],
      thingSeriousOption: [
        {
          value: '01',
          label: 'A级:客观环境或条件可能引发不良事件(不良事件隐患)',
        }, {
          value: '02',
          label: 'B级:不良事件发生但未累及患者',
        },
        {
          value: '03',
          label: 'C级:不良事件累及到患者但没有造成伤害',
        },
        {
          value: '04',
          label: 'D级:不良事件累及到患者需要进行监测以确保患者不被伤害，或需通过干预阻止伤害发生',
        },
        {
          value: '05',
          label: 'E级:不良事件造成患者暂时性伤害并需要进行治疗或干预',
        },
        {
          value: '06',
          label: 'F级:不良事件造成患者暂时性伤害并需要住院或延长住院时间',
        },
        {
          value: '07',
          label: 'G级:不良事件造成事者示久性伤害,但不需要治疗挽数生命',
        },
        {
          value: '08',
          label: 'H级:不良事件发生并导致患者需要治疗挽救生命'
        },
        {
          value: '09',
          label: 'I级:不良事件发生导致患者死亡',
        },

      ],
      fileList: [],
      fileList1: [],
      fileList2: [],
    }
  },

  created() {
    this.formEvent.heEventReport.id = this.$route.query.id;
    if(this.formEvent.heEventReport.id){
      getBasic(this.formEvent.heEventReport.id).then(response => {
        //获取后台传过来的表单
        this.formEvent = response.data;
        //将其对应赋值进行表单渲染
        this.basicForm=this.formEvent.heEventBasic
        this.reportForm=this.formEvent.heEventReport
        this.xian();
      });
    }
    // window.addEventListener("mousewheel", function (event) {
    //   if (event.ctrlKey === true || event.metaKey) {
    //     event.preventDefault();
    //   }
    // }, {passive: false})
  },
  methods: {
    fanhui() {
      if (this.formEvent.heEventReport.id != null){
        this.$router.push({path: "/hosipitalevent/caogaoshijian"});
      }else{
        this.$router.push({path: "/hosipitalevent/report"});
      }
    },
    chuli1(boxlist) {
      this.basicForm.fallDisposal = this.popCheckbox(boxlist);
    },
    dimian1(boxlist) {
      this.basicForm.fallGroundConditions = this.popCheckbox(boxlist);
    },
    yuanyin1(boxlist) {
      this.basicForm.fallCauses = this.popCheckbox(boxlist);
    },
    outputSelectedValues(boxlist) {
      this.basicForm.bedTreatmentConditions = this.popCheckbox(boxlist);
    },
    //el 标签  speed 滚动速率 此处是50px 值越大滚动的越快
    goAssignBlock(el, speed) {
      let t = this.$refs[el].offsetTop - 100

      function scrollToTop() {
        let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;

        if (scrollTop > t) {
          window.scrollTo(0, scrollTop - speed);

          // 使用 requestAnimationFrame 进行平滑滚动
          requestId = window.requestAnimationFrame(scrollToTop);
        } else {
          window.scrollTo(0, t);

          // 取消动画帧的请求
          window.cancelAnimationFrame(requestId);
        }
      }

      let requestId = window.requestAnimationFrame(scrollToTop);
    },

    //这个是由于有的是多选框有的是单选但是我们后台只能接字符串而不是数组所以需要分割下面会调用
    popCheckbox(boxlist) {
      let str = '';
      for (let i = 0; i < boxlist.length; i++) {
        if (i == 0) {
          str = boxlist[i];
        } else {
          str = str + ',' + boxlist[i];
        }
      }
      return str;
    },

    //保存按钮事件
    baocun() {
      // if(this.form.reporttype==''
      //   ||this.form.badname==''
      //   ||this.reportForm.patientname==''
      //   ||this.reportForm.patientage==''
      //   ||this.reportForm.patientgender==''
      //   ||this.reportForm.reportMethod==''
      // ){
      //   this.$modal.msgError("请完整填写事件结果");
      // }
      // else {
      //   this.reportForm.note1 = "费用相关事件"
      //   //将代表事件上报信息表的字段内容赋值给heEventReport对象用于连接后台
      //   this.formEvent.heEventReport = this.reportForm
      //   //将代表事件基本信息表的字段内容赋值给heEventReport对象用于连接后台
      //   this.formEvent.heEventBasic = this.basicForm
      //   //将代表事件基本信息表的字段内容赋值给heEventReport对象用于连接后台
      //   this.formEvent.heEventFlow = this.flowForm
      //   addBasic(this.formEvent).then(response => {
      //     this.$modal.msgError("新增成功");
      //     this.$router.push({path: "/index"});
      //   });
      //
      // }
      this.$refs["form"].validate(valid=>{
          if(valid){


            this.$refs["form1"].validate(valid=>{
              if(valid){

            this.$refs["reportform1"].validate(valid=>{
        if(valid){
      this.$refs["reportForm8"].validate(valid=>{
        if(valid){

        this.$refs["reportForm7"].validate(valid=>{
        if(valid){
          console.log(valid)
          this.$refs["reportform"].validate(valid=>{
            if(valid){
              console.log(valid)
          this.$refs["form2"].validate(valid=>{
            if(valid)
            { if (this.reportForm.patientAdmissionTime !== null) {
              this.reportForm.patientAdmissionTime = this.reportForm.patientAdmissionTime.toLocaleString('zh-CN', {timeZone: 'Asia/Shanghai',hour12: false})
              this.reportForm.patientAdmissionTime = this.reportForm.patientAdmissionTime.replace(/\//g, '-')
            }
              if (this.reportForm.patientDateOfBirth !== null) {
                this.reportForm.patientDateOfBirth = this.reportForm.patientDateOfBirth.toLocaleString('zh-CN', {timeZone: 'Asia/Shanghai',hour12: false})
                this.reportForm.patientDateOfBirth = this.reportForm.patientDateOfBirth.replace(/\//g, '-')
              }
              if (this.reportForm.occurrenceTime !== null) {
                this.reportForm.occurrenceTime = this.reportForm.occurrenceTime.toLocaleString('zh-CN', {timeZone: 'Asia/Shanghai',hour12: false})
                this.reportForm.occurrenceTime = this.reportForm.occurrenceTime.replace(/\//g, '-')
              }
              if (this.reportForm.occurrenceDate !== null) {
                this.reportForm.occurrenceDate = this.reportForm.occurrenceDate.toLocaleString('zh-CN', {timeZone: 'Asia/Shanghai',hour12: false})
                this.reportForm.occurrenceDate = this.reportForm.occurrenceDate.replace(/\//g, '-')
              }
              this.reportForm.note1 = "费用相关事件"
              //将代表事件上报信息表的字段内容赋值给heEventReport对象用于连接后台
              this.formEvent.heEventReport = this.reportForm
              //将代表事件基本信息表的字段内容赋值给heEventReport对象用于连接后台
              this.formEvent.heEventBasic = this.basicForm
              //将代表事件基本信息表的字段内容赋值给heEventReport对象用于连接后台
              this.formEvent.heEventFlow = this.flowForm
              if (this.formEvent.heEventReport.id!= null) {
                updateBasic(this.formEvent).then(response => {
                  this.$modal.msgSuccess("修改成功");
                  this.$router.push({path: "/hosipitalevent/caogaoshijian"});
                });
              } else {
                //否则执行新增
                addBasic(this.formEvent).then(response => {
                  this.$modal.msgSuccess("事件创建成功，请进入并呈送事件！");
                  // this.$router.push({path: "/index"});
                  this.$router.push({path: "/hosipitalevent/caogaoshijian"});//跳转到呈送页面
                });
              }
            }
          })
        }
      });}
      })   } })  }})






          }}); }});







    },

    ding() {
      window.scrollTo(0, 0);
    },


    //上传图片
    handleRemove(file) {
      this.fileList = this.fileList.filter(item => item.uid !== file.uid);
    },
    handleExceed() {
      this.msgError("最多只能传500张照片");
    },
    beforeUpload(file) {
      const isJPG = file.type === "image/jpeg" || file.type == "image/png";
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isJPG) {
        this.$message.error("上传头像图片只能是 JPG 或 PNG 格式!");
        return;
      }
      if (!isLt2M) {
        this.$message.error("上传头像图片大小不能超过 2MB!");
        return;
      }
      const fileData = new FormData();
      fileData.append("avatar", file);
      //upload为上传的接口
      upload(fileData).then(res => {
        this.imgUrl = res.imgUrl;
        //对返回的图片地址进行回显
        this.$set(this.form, "avatar", this.imgUrl);
      });
      //阻止传到本地浏览器
      return false;
    },

  },

}

</script>

<style lang="scss" scoped>
@import "src/views/module/shao/blackFont";
.sidebar {
  margin-left: 3%;
  width: 10%;
  float: left;
  display: flex;
}

.content {
  margin-left: 3%;
  margin-right: 1.5%;
  width: 87%;
  float: right;
}

.btn-box {
  position: fixed;
  margin-top: 1%;

  ::v-deep .el-card__body {
    padding: 15px 15px 15px 5px;
  }
}

.btn-box button {
  text-align: left;
  padding: 0 0 0 10px;
  display: block;
  width: 150px;
  height: 40px;
  border: none;
  cursor: pointer;
}

.btn-box button:hover {
  background: hsl(221, 98%, 68%);
  color: white;
}

.block {
  border: 1px solid white;
  width: 100%;
  height: 100%;
  display: flex;
  font-size: 5rem;
  box-sizing: border-box;

  .el-form-item {
    margin-bottom: 10px;
  }
}

.bname {
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
  font-weight: bold;
  font-size: 20px;
  color: #000;
}

</style>
